<template>
  <h1>test</h1>
  <div @click="handleGetAllcarList">获取所有汽车</div>
  <div @click="handleGetAllcarPosition">获取汽车路径</div>
</template>
<script setup>
import { getCarList ,getCarPosition} from "@/request/users";
import { onMounted } from "vue";


const handleGetAllcarList = ()=>{
  getCarList().then((res) => {
    console.log("获取所有汽车", res);
  });
}

const handleGetAllcarPosition = ()=>{
  const time = new Date().getTime()
  getCarPosition({time}).then((res) => {
    console.log("获取汽车路径", res);
  });
}

onMounted(()=>{
  // handleGetAllcarList()
  // let curTime = new Date().getTime() // 指令执行的时间戳
  // setInterval(() => {
  //   const time = new Date().getTime()
  //   getCarPosition({time}).then(res=>{
  //     console.log('res',res);
  //   })
  // }, 300);
 
})


</script>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
